@import './variables';
* {
    box-sizing: border-box;
    outline: none;
}

html {
    font-size: 13px;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.2em;
    background-color: #f1f1f1;
    -webkit-font-smoothing: antialiased;
}

a {
    color: #999;
}

//colors颜色
@each $colorKey,
$color in $colors {
    .text-#{$colorKey} {
        color: $color;
    }
    .bg-#{$colorKey} {
        background-color: $color;
    }
}

// //text
@each $var in (left, center, right) {
    .text-#{$var} {
        text-align: $var!important;
    }
}

//font font-size字体大小
@each $sizeKey,
$size in $font-sizes {
    .fs-#{$sizeKey} {
        font-size: $size * $base-font-size
    }
}

//flex布局
.d-flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

@each $key,
$value in $flex-jc {
    .jc-#{$key} {
        justify-content: $value;
    }
}

@each $key,
$value in $flex-ai {
    .ai-#{$key} {
        align-items: $value;
    }
}

.flex-1 {
    flex: 1;
}

.flex-grow-1 {
    flex-grow: 1;
}

//边距spacing
// m-0, mx-0
@each $typeKey,
$type in $spacing-types {
    // .m-1
    @each $sizeKey,
    $size in $spacing-sizes {
        .#{$typeKey}-#{$sizeKey} {
            #{$type}: $size * $spacing-base-size;
        }
    }
    // .mx-1 , .my-1
    @each $sizeKey,
    $size in $spacing-sizes {
        .#{$typeKey}x-#{$sizeKey} {
            #{$type}-left: $size * $spacing-base-size;
            #{$type}-right: $size * $spacing-base-size;
        }
        .#{$typeKey}y-#{$sizeKey} {
            #{$type}-top: $size * $spacing-base-size;
            #{$type}-bottom: $size * $spacing-base-size;
        }
    }
    // .mt-1
    @each $directionKey,
    $direction in $spacing-directions {
        @each $sizeKey,
        $size in $spacing-sizes {
            .#{$typeKey}#{$directionKey}-#{$sizeKey} {
                #{$type}-#{$direction}: $size * $spacing-base-size;
            }
        }
    }
}

//button 按钮
.btn {
    box-sizing: content-box;
    border: none;
    border-radius: .153846rem;
    font-size: map-get($font-sizes, 'sm') * $base-font-size;
    padding: 0.2ren 0.6rem;
    &.btn-lg {
        display: flex;
        justify-content: center;
        align-items: center;
        i {
            color: map-get($map: $colors, $key: 'primary');
            font-weight: bold;
            font-size: 1.5rem;
            margin-right: 0.5rem;
        }
        background: map-get($map: $colors, $key: 'light');
        border: 1px solid $border-color;
        padding: 0.8rem 1rem;
        font-size: 1.1rem;
    }
}

//nav
.nav {
    // display: flex;
    // justify-content: space-around;
    .nav-item {
        border-bottom: 3px solid transparent;
        padding-bottom: 0.2rem;
        &.active {
            border-bottom: 3px solid map-get($map: $colors, $key: 'primary');
            color: map-get($map: $colors, $key: 'primary');
        }
    }
    &.nav-inverse {
        .nav-item {
            color: map-get($colors, 'white');
            &.active {
                border-bottom-color: map-get($map: $colors, $key: 'white');
            }
        }
    }
}

//width,height
.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

//sprite
.sprite {
    background: url('../images/index.png') no-repeat 0 0;
    background-size: 23.4375rem;
    display: inline-block;
    &.sprite-news {
        width: 1.4375rem;
        height: 1.25rem;
        background-position: 63.546% 15.517%;
    }
    &.sprite-arrow {
        width: .625rem;
        height: .625rem;
        background-position: 38.577% 52.076%;
    }
}

//文字溢出隐藏
.text-ellipsis {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

p {
    line-height: 1.5rem;
}

//borders
@each $dir in (top,
right,
bottom,
left) {
    .border-#{$dir} {
        border-#{$dir}: 1px solid $border-color;
    }
}